package com.example.springboottestgit.service.instruction.stage1;

import com.example.springboottestgit.bean.InstructData;
import com.example.springboottestgit.common.RunNum;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @description:履约保证金
 * @author: ZZZ
 */
@Service
public class PromiseMargin {
    public List<InstructData> getInstructData() {
        List<InstructData> list = new ArrayList<>();
        for (int i = 1; i <= RunNum.a; i++) {
            list.add(mul(i % 2 == 0));
        }
        return list;
    }

    public InstructData mul(Boolean b) {
        Random random = new Random();
        //Boolean b = random.nextBoolean();
        int x = random.nextInt(10) + 1;
        if (b == true) {
            x = random.nextInt(20) + 10;
        }

        String sign = x <= 10 ? "符合" : "不符合";

        String instruction = "中标或者成交供应商缴纳履约保证金为合同金额的x%是否符合法律法规";
        String input = "";
        String output = "#。根据《中华人民共和国政府采购法实施条例》第四十八条规定，采购文件要求中标或者成交供应商提交履约保证金的数额不得超过政府采购合同金额的10%,因此案例中中标或者成交供应商缴纳履约保证金为合同金额的x%#法律法规。";

        instruction = instruction.replace("x", x + "");
        output = output.replace("x", x + "").replace("#", sign + "");

        InstructData instructData = new InstructData();
        instructData.setInstruction(instruction);
        instructData.setInput("");
        instructData.setOutput(output);
        return instructData;
    }

}
